package com.sample.traffic.action.sjgc;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
//import com.sample.traffic.action.dthb.dao.DthbGisDAO;
import com.sample.traffic.action.sjgc.dao.SjgcGisDAO;
import com.sample.traffic.action.sjgc.entity.SjgcGisEntity;

public class SjgcGisAction extends ActionSupport {
	
	
	
	public String init() throws Exception {
		// TODO Auto-generated method stub
	
		return SUCCESS;
	}
	
	
	
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		ActionContext ctx = ActionContext.getContext();         
		HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
		SjgcGisDAO dao = new SjgcGisDAO();
		request.setAttribute("nodeList",dao.getNodeInfo());
		return SUCCESS;
	}
	
	
	
	public String showSp() throws Exception {
		// TODO Auto-generated method stub
		ActionContext ctx = ActionContext.getContext();         
		HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
		String nodeid = request.getParameter("node");
		SjgcGisDAO dao = new SjgcGisDAO();
		SjgcGisEntity entity = new SjgcGisEntity();
		request.setAttribute("list", dao.getInfo(nodeid));
		return SUCCESS;
	}
	
	
	public String nodeDetail() throws Exception {
		// TODO Auto-generated method stub
		ActionContext ctx = ActionContext.getContext();         
		HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
		String nodeid = request.getParameter("node");
		SjgcGisDAO dao = new SjgcGisDAO();
		SjgcGisEntity entity = new SjgcGisEntity();
		request.setAttribute("list", dao.getNodeDetail(nodeid));
		request.setAttribute("node", nodeid);
		return SUCCESS;
	}
	
}
